package com.runfast.paotui.dao.model;

import com.runfast.pay.Channel;
import com.runfast.waimai.dao.model.WaiMaiRunfastCuseraddress;
import com.runfast.waimai.dao.model.WaiMaiRunfastShopper;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
public class Order implements Serializable {
    /**拍腿订单状态：0下单，1取消，2付款，3骑手接单，4完成,5已取货*/
    public enum Status {CREATED, CANCELED, PAID, TAKEN, COMPLETED,PICKED}
    /**源地址类型：0指定地址，1附近购买*/
    public enum FromType {SPECIFIED, NEARBY}
    /**订单类型：0代购，1取送件*/
    public enum Type {DAIGOU, QUSONGJIAN}


    public interface Daigou {
    }
    public interface Qusongjian {
    }
    public interface Specified {
    }
    public interface NearBy {
    }

    private Integer id;
    /*** 创建时间*/
    private Date createTime;

    /*** 修改时间*/
    private Date updateTime;

    /*** 已支付金额*/
    private Integer amountPaid;

    /*** 应支付金额*/
    private Integer amountPayable;

    /*** 配送费*/
    private Integer deliveryCost;

    /*** 源地址*/
    @NotBlank(groups = {Specified.class})
    private String fromAddress;

    /*** 源纬度*/
    @NotNull(groups = {Specified.class})
    private Double fromLat;

    /*** 源经度*/
    @NotNull(groups = {Specified.class})
    private Double fromLng;

    /*** 源地址类型*/
    @NotNull(groups = {Daigou.class})
    private FromType fromType;

    /*** 商品描述*/
    @NotBlank(groups = {Daigou.class})
    private String goodsDescription;

    /*** 商品类型*/
    @NotNull(groups = {Qusongjian.class})
    private String goodsType;

    /*** 商品重量*/
    @NotNull(groups = {Qusongjian.class})
    private Integer goodsWeight;

    /*** 保险*/
    private Integer insurance;

    /*** 订单号*/
    private String orderNo;

    /*** 订单状态*/
    private Status status;

    /*** 取货时间*/
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(groups = {Qusongjian.class})
    private Date pickTime;

    /*** 备注*/
    private String remark;

    /*** 建议商品价格*/
    private Integer suggestionCost;

    /*** 小费*/
    private Integer tip;

    /*** 当前订单所属用户*/
    private Integer cuserId;

    /*** 骑手id*/
    private Integer driverId;

    /*** 源地址id*/
    @NotNull(groups = {Qusongjian.class})
    private Integer fromId;

    /*** 目的地id*/
    @NotNull(groups = {Daigou.class, Qusongjian.class})
    private Integer toId;

    /*** 订单类型*/
    @NotNull(groups = {Daigou.class, Qusongjian.class})
    private Type type;

    /*** 距离*/
    private Integer distance;


    /*** 预计配送时间*/
    private Integer deliveryDuration;

    /*** 骑手收入*/
    private Integer driverIncome;

    /*** 平台收入*/
    private Integer plateformIncome;

    /*** 叶子节点代理商收入*/
    private Integer agentIncome;
    /**用户经度*/
    @NotNull(groups = {Daigou.class, Qusongjian.class})
    private Double userLng;
    /**用户纬度*/
    @NotNull(groups = {Daigou.class, Qusongjian.class})
    private Double userLat;

    /*** 附近代理商*/
    private Integer agentId;

    /*** 退款总金额*/
    private Integer amountRefunded;

    /*** 是否存在退款*/
    private Boolean refunded;

    /*** 是否已支付*/
    private Boolean paid;

    /*** 是否已取消*/
    private Boolean canceled;

    /*** 是否已接单*/
    private Boolean taken;

    /*** 是否已完成*/
    private Boolean completed;

    /**支付时间*/
    private Date timePaid;

    /**取消时间*/
    private Date timeCanceled;

    /**接单时间*/
    private Date timeTaken;

    /**完成时间*/
    private Date timeCompleted;

    /*** 支付渠道:*/
    private Channel channel;

    /**是否删除*/
    private Boolean deleted;

    /*** 取件的地址名称*/
    private String fromName;

    /*** 1:用户提出 2:骑手同意3:不同意；4：系统超时确认*/
    private Integer isCancel;

    /*** 申请取消的时间*/
    private Date cancelTime;

    /**查询时使用：代理商id串*/
    private String  agentIds;
    private String shopperName;
    private String shopperMobile;
    private String userName;
    private String userMobile;
    /**取件客户信息*/
    private WaiMaiRunfastCuseraddress cuseraddress=new WaiMaiRunfastCuseraddress();
    /**订单状态列表*/
    private List<OrderStatusHistory> orderStatusHistoryList=new ArrayList<OrderStatusHistory>();
    /**骑手信息*/
    private WaiMaiRunfastShopper waiMaiRunfastShopper=new WaiMaiRunfastShopper();
    /**查询用的：支付方式：0支付宝，1微信，2余额，3微信公众号，4微信小程序*/
    private Integer paymethod;
    /**查询用的：时间*/
    private String date;
    /**跑腿调度台显示的：取送货地址信息*/
    /*** 源地址*/
    private String diaoDuFromAddress;
    /*** 源纬度*/
    private String diaoDuFromLat;
    /*** 源经度*/
    private String diaoDuFromLng;
    /*** 目的地址*/
    private String diaoDuToAddress;
    /*** 目的纬度*/
    private String diaoDuToLat;
    /*** 目的经度*/
    private String diaoDuToLng;
    /*** 收货人名字*/
    private String diaoDuToUserName;
    /*** 收货人电话*/
    private String diaoDuToMobile;


    /**websocket里使用：是否异常0否，1是*/
    private  Integer abnormal;
    private List<Integer> ids=new ArrayList<Integer>();
    private static final long serialVersionUID = 1L;
}